package com.weifangfirecontrolformal.weifangfirecontrolformal.web.web.maintenancesystem.basisinfo;

import cn.hutool.json.JSONObject;
import com.weifangfirecontrolformal.weifangfirecontrolformal.common.base.BaseController;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.Action;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.At;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.model.RespEntity;
import com.weifangfirecontrolformal.weifangfirecontrolformal.web.service.maintenancesystem.basisinfo.ControllerService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

/**
 * @Author: YangYu
 * @ClassName: ControllerDataController
 * @Date: Created in 10:44 2020/12/22
 * @Description:
 */
@Action
@RequestMapping(value = "basisinfo/controller")
public class ControllerDataController extends BaseController {

    @Resource
    private ControllerService controllerService;
    /**
     * @Author YangYu
     * @Description 控制器分页列表
     * @Date Created in 11:07 2020/12/22
     * @Param [jsonParam]
     */

    @At(value = "controllerPagList", method = RequestMethod.GET, param = {"page", "limit"})
    public RespEntity controllerPagList(@RequestBody(required = false) JSONObject jsonParam) {
        return controllerService.controllerPagList(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 控制器详情
     * @Date Created in 10:22 2020/12/24
     * @Param [jsonParam]
     */

    @At(value = "detail", method = RequestMethod.GET)
    public RespEntity detail(@RequestBody(required = false) JSONObject jsonParam) {
        return controllerService.detail(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 控制器新增
     * @Date Created in 10:23 2020/12/24
     * @Param [jsonParam]
     */

    @At(value = "add", method = RequestMethod.POST)
    public RespEntity add(@RequestBody(required = false) JSONObject jsonParam) {
        return controllerService.add(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 控制器更新
     * @Date Created in 10:24 2020/12/24
     * @Param [jsonParam]
     */

    @At(value = "update", method = RequestMethod.POST)
    public RespEntity update(@RequestBody(required = false) JSONObject jsonParam) {
        return controllerService.update(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 控制器删除
     * @Date Created in 10:29 2020/12/24
     * @Param [jsonParam]
     */

    @At(value = "delete", method = RequestMethod.POST)
    public RespEntity delete(@RequestBody(required = false) JSONObject jsonParam) {
        return controllerService.delete(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 控制器不分页列表
     * @Date Created in 15:04 2021/1/6
     * @Param [jsonParam]
     */

    @At(value = "controllerList", method = RequestMethod.GET)
    public RespEntity controllerList(@RequestBody(required = false) JSONObject jsonParam) {
        return controllerService.controllerList(jsonParam);
    }
}
